<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>IMDb 电影</title>

    <!-- 引入样式 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- 引入组件库 -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>

    <style>
        body {
            background-color: #343434;
            margin-top: 0;
        }

        .el-carousel__item h3 {
            color: #475669;
            font-size: 14px;
            opacity: 0.75;
            line-height: 200px;
        }

        .el-carousel__item:nth-child(2n) {
            background-color: #99a9bf;
        }

        .el-carousel__item:nth-child(2n+1) {
            background-color: #d3dce6;
        }

        .grid-content {
            height: 80px;
            background-color: #475669;
            margin-top: 0px;
            margin-bottom: 15px;
        }

        .grid-content {
            border-radius: 4px;
            min-height: 36px;
            justify-content: center;
            text-align: center;
            line-height: 80px;

        }

        .search-box {
            position: relative;
            text-align: center;
        }

        .el-form {
            position: relative;
            line-height: 80px;
            top: 21px;
        }

        .el-form .el-form-item__label {
            color: white !important;
        }

        .my-search {
            position: absolute;
            right: 10px;
            top: 34px;
            cursor: pointer;
        }

        .logo {
            width: 40%;
            height: 50px;
            position: relative;
            line-height: 80px;
            top: 15px;
        }


        .top-tab div {
            display: inline-block;
            color: white;

            cursor: pointer;
            margin-left: 20px;
        }


        .top-tab div a {
            text-decoration: none; /* 去除默认的下划线 */
            color: white; /* 去除默认的颜色和点击后变化的颜色 */

        }


        .top-tab div a:hover {
            color: yellow;
            font-size: 20px;
        }

        .mytab {
            color: white;

        }

        .mytab .el-tabs__item {
            color: white;
        }

        .card-image {
            margin: 5px;
        }


        .Top250Movies {
            margin-top: 20px;
            color: white;

        }

        .Top250Movies .title {
            display: inline-block;
            font-size: 20px;
            margin-left: 20px;
            cursor: pointer
        }

        .top200-image-box {
            margin-top: 10px;
        }

        .top200-image {
            margin: 3px;

        }

        .top200-image .image {
            width: 100%;
        }

        .el-card__body, .el-main {
            padding: 5px;
        }

        .grade-box {
            display: inline-block;
            height: 20px;
            line-height: 20px;
        }

        .grade-box div {
            display: inline-block;
            text-align: center;
            line-height: 20px;
        }

        .grade-box .score {
            display: inline-block;
            color: #000000;
            position: absolute;
            line-height: 20px;
        }

        .grade-box img {
            width: 20px;
            height: 20px;
        }

        .top200-image .title {
            font-size: 18px;
            font-weight: 500;
            margin-left: 5px;
            height: 50px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }

        .box-card {
            margin-top: 10px;
            max-height: 500px;
            text-align: center;
        }

    </style>
<body>
<div id="box">

    <el-row>
        <el-col :span="24">
            <div class="grid-content bg-purple-dark">
                <el-row>
                    <el-col :span="8">
                        <div class="grid-content">
                            <img src="/static/img/logo.png" class="logo">
                        </div>
                    </el-col>
                    <el-col :span="8">
                        <div class="grid-content search-box">

                            <el-form ref="form" :model="form" label-width="80px">
                                <el-form-item label="电影搜索:">
                                    <el-input v-model="form.search_value" placeholder="请用英文搜索"></el-input>
                                </el-form-item>
                            </el-form>

                            <i class="el-icon-search my-search" @click="search"></i>
                        </div>
                    </el-col>
                    <el-col :span="8">
                        <div class="grid-content top-tab">
                            <div><a href="/"> <i class="el-icon-s-home"> </i> 首页 </a></div>
                        </div>
                    </el-col>
                </el-row>
            </div>
        </el-col>
    </el-row>

    <template>
        <el-row :gutter="20">
            <el-col :span="16">

                <!--这里显示海报-->
                <el-card class="box-card">

                    <img :src="detail_data.image">

                </el-card>

            </el-col>
            <el-col :span="8">

                <!--  这里显示文字描述-->
                <el-tag> 剧名：</el-tag>
                <el-card class="box-card">
                    {[detail_data.fullTitle]}
                </el-card>
                <el-divider></el-divider>
                <el-tag> 剧情：</el-tag>
                <el-card class="box-card">
                    {[detail_data.plotLocal]}
                </el-card>
                <el-divider></el-divider>
                <el-tag> 主演：</el-tag>
                <el-card class="box-card">
                    {[detail_data.stars]}

                </el-card>


            </el-col>
        </el-row>
    </template>


    <input hidden value="{{data}}" id="ss">
</div>
</body>


<script src="/static/js/axios.js"></script>
<script src="/static/js/qs.js"></script>


<script>

    Vue.component('my_rate', {
        data: {},
        delimiters: ['{[', ']}'],   // 避免vue 与模板   冲突
        mounted() {
        },
        props: ['myon', "myoff"],
        template: '<div><img  v-for="i in myon" src="/static/img/x1.png"/><img v-for="i in myoff" src="/static/img/x2.png"/></div> '
    });


    const vm = new Vue(
        {
            el: "#box",
            delimiters: ['{[', ']}'],
            data: {

                posters: [],
                this_localhost: "",
                form: {
                    search_value: ""
                },
                activeName: 'first',
                searchData: [],
                detail_data: {}


            }, created() {

            },

            mounted() {

                this.detail_data = document.getElementById("ss").value;
                if (this.detail_data) {
                    this.detail_data = JSON.parse(this.detail_data)
                }
                console.log(this.detail_data)
                this.this_localhost = document.location.protocol + "//" + location.host;


            },

            methods: {
                search() {
                    var search_value = this.form.search_value;
                    if (!search_value) {
                        return
                    } else {
                        window.location.href = "/search?search_value=" + search_value
                    }
                },


                get_myon_or_myoff(score, k) {
                    var myon = 0
                    var myoff = 0
                    if (score <= 0) {
                        myon = 0
                        myoff = 5
                    } else if (score < 2) {
                        myon = 1
                        myoff = 4

                    } else if (score < 4) {
                        myon = 2
                        myoff = 3
                    } else if (score < 6) {
                        myon = 3
                        myoff = 2
                    } else if (score < 8) {
                        myon = 4
                        myoff = 1
                    } else if (score <= 10) {
                        myon = 5
                        myoff = 0
                    }
                    console.log(typeof (score), myon, myoff);
                    if (k === "myon") {
                        return myon
                    } else {
                        return myoff
                    }
                }


            }
        })

</script>

</html>